import styles from './index.module.scss'

type PropsType = {
  close: () => void
  type: '' | 'photo' | 'gender'
  update: (val: number, type: string) => void
}

const genderList = [
  { title: '男', value: 0 },
  { title: '女', value: 1 },
  // { title: '女2', value: 2 },
]

const photoList = [
  { title: '拍照', value: 1 },
  { title: '本地选择', value: 0 },
]

const EditList = ({ close, type, update }: PropsType) => {
  const list = type === 'gender' ? genderList : photoList
  return (
    <div className={styles.root}>
      {list.map((item) => {
        return (
          <div
            className="list-item"
            key={item.title}
            onClick={() => {
              update(item.value, type)
            }}
          >
            {item.title}
          </div>
        )
      })}

      {/* {type === 'gender' ? (
        <>
          <div className="list-item">男</div>
          <div className="list-item">女</div>
        </>
      ) : (
        <>
          <div className="list-item">拍照</div>
          <div className="list-item">本地选择</div>
        </>
      )} */}

      <div className="list-item" onClick={close}>
        取消
      </div>
    </div>
  )
}

export default EditList
